<div ng-include="sys_html('common/_header')"></div>
<div class="fui-page fui-page-current page-commission-team">
	<div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
			<a class="back"></a>
		</div>
		<div class="title">商城公告</div>
	</div>
	<div class="fui-content navbar">

		<div class='content-empty' style='display:none;'>
			<i class='icon icon-group'></i><br/>暂时没有任何公告
		</div>
		<div class="fui-title"></div>
		<div class="fui-list-group" id="container">
				<a ng-repeat="item in pagedata.list" class="external" ng-click="access_json('/shop.notice/detail/id='+item.id)" data-nocache="true">
					<div class="fui-list">
						<div class="fui-list-media">
							<img ng-src="{{tomedia(item.image) ||'../core/resource/images/nopic.jpg'}}" class="round">
						</div>
						<div class="fui-list-inner">
							<div class="row">
								<div class="row-text">{{item.title}}</div>
							</div>
							<div class="subtitle">{{date(item.createtime)}}</div>
						</div>
						<div class="fui-list-angle">
							<div class="angle"></div>
						</div>
					</div>
				</a>
		</div>
		<div id="loading" class='infinite-loading'><span class='fui-preloader'></span><span class='text'> 正在加载...</span></div>

	</div>

</div>
<div ng-include="sys_html('common/_share')"></div>
<div ng-include="sys_html('common/_menu')"></div>
<div ng-include="sys_html('common/_footer')"></div>
<script>

scope.pagedata.list=[];
		scope.pagedata.get_list=function(first){
			if(first){
				//初次加载
				scope.pagedata.page=1;
				scope.pagedata.list=[];
				scope.pagedata.loaded=false;
				$('#loaded').hide();
			}else if(!scope.pagedata.page){
				scope.pagedata.page=1;
			}else{
				scope.pagedata.page++;
			}
			if(scope.pagedata.loaded){
				return;
			}
			if(scope.pagedata.loading){
				return;
			}else{
				scope.pagedata.loading=true;
			}
			$('#loading').show();$('#loadmore').hide();
			var query='page='+scope.pagedata.page;
			if(scope.page.query){
				query+='&'+scope.page.query;
			}
			var more_query=scope.made_query(scope.pagedata.params);
			if(more_query){
				query+='&'+more_query;
			}
			scope.get_data(function(res){
				if(!Array.isArray(res)){
					console.log('数据加载失败！');
					console.log(res);
					return;
				}
				if(res.length==0){
					scope.pagedata.loaded=true;
					scope.$apply();
					scope.pagedata.loading=false;
					$('#loading').hide();
					$('#loaded').show();
					if(scope.pagedata.list.length==0){
						$('#no_goods').show();
					}
					return;
				}
				res.forEach(function(v){
					scope.pagedata.list.push(v);
				});
				scope.pagedata.loading=false;
				scope.$apply();
				$('#loading').hide();
				$('#loadmore').show();
				
			},'',{'op':'getlist','query':query});
		}
		//首次加载
		scope.pagedata.get_list(true);
		//滑到页面底部时加载下一页
		scope.scroll(function(){
			scope.pagedata.get_list();
		});

	</script>
